package com.itheima.java;
/*递归算法求1到数字number的和*/
public class Test4 {
    public static void main(String[] args) {
        int sum = getSum(100);
        System.out.println(sum);
    }
    public static int getSum(int number) {
        if (number == 1) {
            return 1;
        }
        return number + getSum(number - 1);
    }
}